﻿<Window x:Class="ISRecord.View.Views.SearchOutboxView"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:p="clr-namespace:ISRecord.View.Properties"
        xmlns:converters="clr-namespace:ISRecord.View"
        Title="SearchOutboxView" Height="Auto" Width="Auto"
        Style="{StaticResource WindowStyle}">
    <Window.Resources>
        <converters:DateConverter x:Key="dateConverter"/>
    </Window.Resources>
    <Grid >
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition Width="*" />
        </Grid.ColumnDefinitions>
        <ToolBar Grid.ColumnSpan="3" Height="Auto" HorizontalAlignment="Left" Margin="3.5" Name="toolBar1" 
                 VerticalAlignment="Top" Width="927" >
            <Button Content="{StaticResource OpenImage}" Height="Auto" HorizontalAlignment="Left" Margin="3.5" Name="okButton" 
                    VerticalAlignment="Top" Width="Auto" Click="OkButton_Click" />
        </ToolBar>
        <TextBlock Grid.Row="1" Height="Auto" HorizontalAlignment="Stretch" Margin="3.5" Name="textBlock1" 
                   Text="{x:Static p:Resources.OutboxSeachChoices}" VerticalAlignment="Center" />
        <Rectangle Grid.Row="2" Grid.ColumnSpan="3" Fill="#FFF4F4F5" Height="1" Margin="3.5" Stroke="Black" VerticalAlignment="Top"/>
        <TextBlock Height="Auto" HorizontalAlignment="Stretch" Margin="3.5" Name="textBlock2" 
                   Text="{x:Static p:Resources.OutboxNo}" VerticalAlignment="Center" Grid.Row="3" />
        <TextBlock Height="Auto" HorizontalAlignment="Stretch" Margin="3.5" Name="textBlock3" 
                   Text="{x:Static p:Resources.OutboxSubject}" VerticalAlignment="Center" Grid.Row="4" />
        <TextBlock Height="Auto" HorizontalAlignment="Stretch" Margin="3.5" Name="textBlock4" 
                   Text="{x:Static p:Resources.OutboxGoingTo}" VerticalAlignment="Center" Grid.Row="5" />

        <TextBox Grid.Column="1" Grid.Row="3" Height="Auto" HorizontalAlignment="Left" Margin="3.5" Name="textBox1" VerticalAlignment="Center" Width="300" 
                 Text="{Binding OutboxNo, UpdateSourceTrigger=PropertyChanged}"/>
        <TextBox Height="Auto" HorizontalAlignment="Left" Margin="3.5" Name="textBox2" VerticalAlignment="Center" Width="300" Grid.Column="1" Grid.Row="4" 
                 Text="{Binding Subject, UpdateSourceTrigger=PropertyChanged}"/>
        <TextBox Height="Auto" HorizontalAlignment="Left" Margin="3.5" Name="textBox3" VerticalAlignment="Center" Width="300" Grid.Column="1" Grid.Row="5" 
                 Text="{Binding GoingTo, UpdateSourceTrigger=PropertyChanged}"/>
        <Button Content="{Binding Source={StaticResource FindImage}}" Grid.Column="2" Grid.Row="3" Height="Auto" HorizontalAlignment="Left" Margin="3.5" Name="button1" VerticalAlignment="Top" Width="Auto" 
                Command="{Binding Path=FilterCommand}" CommandParameter="ByOutbox"/>
        <Button Content="{Binding Source={StaticResource FindImage}}" Height="Auto" HorizontalAlignment="Left" Margin="3.5" Name="button2" VerticalAlignment="Top" Width="Auto" Grid.Column="2" Grid.Row="4"
                Command="{Binding Path=FilterCommand}" CommandParameter="BySubject"/>
        <Button Content="{Binding Source={StaticResource FindImage}}" Height="Auto" HorizontalAlignment="Left" Margin="3.5" Name="button3" VerticalAlignment="Top" Width="Auto" Grid.Column="2" Grid.Row="5" 
                Command="{Binding Path=FilterCommand}" CommandParameter="ByGoingTo"/>
        <ListView Grid.ColumnSpan="3" Grid.Row="6" Height="Auto" Margin="3.5" Name="listView1" VerticalAlignment="Top" Width="Auto" 
                  ItemsSource="{Binding Path=Outboxes}" SelectionMode="Single" IsSynchronizedWithCurrentItem="True">
            <ListView.ItemContainerStyle>
                <Style TargetType="ListViewItem">
                    <EventSetter Event="MouseDoubleClick" Handler="SelectedItemDoubleClick"/>
                </Style>
            </ListView.ItemContainerStyle>
            <ListView.View>
                <GridView  >
                    <GridViewColumn Header="{x:Static p:Resources.OutboxNo}" DisplayMemberBinding="{Binding Path=OutboxNo}"/>
                    <GridViewColumn Header="{x:Static p:Resources.OutboxDate}">
                        <GridViewColumn.DisplayMemberBinding>
                            <Binding Path="OutboxDate" Converter="{StaticResource dateConverter}"/>
                        </GridViewColumn.DisplayMemberBinding>
                    </GridViewColumn>
                    <GridViewColumn Header="{x:Static p:Resources.OutboxSubject}" DisplayMemberBinding="{Binding Path=Subject}"
                                    />
                    <GridViewColumn Header="{x:Static p:Resources.OutboxGoingTo}" DisplayMemberBinding="{Binding Path=GoingTo}"
                                    Width="Auto"/>
                </GridView>
            </ListView.View>
        </ListView>
        
    </Grid>
</Window>
